    

<meta charset="utf-8">



            
       <?php

            try
	{
		$bdd = new PDO('mysql:host=localhost;dbname=exiastore', 'root', '');
	}
	catch (Exception $e)
	{
		die('Erreur : ' . $e->getMessage());
	}
  
        
     session_start();     
        
    $login = $_POST['login'];
    $pass = $_POST['pass']; 
	
    $req = $bdd->prepare('SELECT login FROM membre WHERE login = :login AND motDePasse = :pass');
    $req->execute(array(
    'login' => $login,
    'pass' => $pass));
        

 
    $resultat = $req->fetch();
        
        if (!$resultat)
        {   
            echo "<script> alert('Identifiants incorrects') </script>";
            header("Refresh: 0; URL=index.php");
        } 
 
        else
        {
           
            $_SESSION['login']=$login; 
            echo "<script> alert('Vous êtes connecté !') </script>"; 
            header("Refresh: 0; URL=index.php");
            
        }


?>